<template>
  <div
    class="fixed"
    right-0
    bottom-0
    flex
    flex-col
    justify-center
    items-center
    w-118px
    h-239px
    z-10
    @click.prevent="backPage">
    <img z-11 absolute w-118px h-239px src="@/assets/images/back_bg.png" />
    <img z-12 w-45px h-40px src="@/assets/images/back.png" />
    <div z-12 text="#fff" text-27px mt-10px>{{ title }}</div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const title = ref('')

function backPage() {
  router.back()
  // window.location.href = '/';
}

onMounted(() => {
  const routeHistory = router.options.history.state.back
  title.value = routeHistory === null || routeHistory === '/' ? '首页' : '返回'
})
</script>

<style scoped></style>
